<<<<<<< HEAD
<!--
 * @Author: Xia_cc 978487464@qq.com
 * @Date: 2022-06-08 16:57:05
 * @LastEditors: Xia_cc 978487464@qq.com
 * @LastEditTime: 2022-06-10 18:40:12
 * @FilePath: \vue 小U到家\src\views\Mainyonghu.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!--  -->
<template>
  <el-container>
    <el-header>
      关键字:<el-input
        class="search"
        type="text"
        placeholder="请输入内容"
        v-model="text"
        @change="selects()"
        size="mini"
      ></el-input>
      状态:<el-select
        class="search"
        @input="selects()"
        v-model="yongHuZhuangTai"
        size="mini"
        placeholder="请选择"
      >
        <el-option
          v-for="item in yongHuZhuangTaiArr"
          :key="item.YHvalue"
          :label="item.YHlabel"
          :value="item.value"
          size="mini"
        >
        </el-option>
      </el-select>
      站点:<el-select
        class="search"
        @input="selects()"
        v-model="yongHuZhanDian"
        size="mini"
        placeholder="请选择"
      >
        <el-option
          v-for="item in yongHuZhanDianArr"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
    </el-header>

    <el-main>
      <el-row>
        <el-button type="info" plain>导出</el-button>
        <el-button type="info" plain>冻结/解冻</el-button>
      </el-row>
      <Maintable :tableData="yonghuArr">
        <template v-slot:tableline>
          <el-table-column prop="name" label="姓名" width="120"> </el-table-column>
          <el-table-column prop="phone" label="电话" width="160"> </el-table-column>
          <el-table-column prop="commitdate" label="最后活跃时间" width="180"> </el-table-column>
          <el-table-column prop="order_id" label="配送订单数" width="120"> </el-table-column>
          <el-table-column prop="site_name" label="所属站点" width="160"> </el-table-column>
          <el-table-column prop="state" label="状态" width="120">
            <template slot-scope="scope">{{
              scope.row.state == 0 ? "正常" : "冻结中"
            }}</template></el-table-column
          >
        </template>
        <template v-slot:chaozuo>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button
                type="success"
                slot="reference"
                plain
                title="查看"
                icon="el-icon-view"
                @click="yhChaKan"
              >
              </el-button>
              <el-button
                type="primary"
                plain
                icon="el-icon-edit"
                title="编辑"
                @click="chakan(scope.row.id)"
              ></el-button>
              <el-button
                type="danger"
                plain
                icon="el-icon-delete"
                title="删除"
                @click="psyDelBut(scope.row.id)"
              ></el-button>
            </template>
          </el-table-column>
        </template>
      </Maintable>
    </el-main>
    <el-footer>
      <div class="block">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-sizes="[6, 8, 10, 12]"
          :page-size="100"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
        >
        </el-pagination>
      </div>
    </el-footer>
  </el-container>
</template>

<script>
import Maintable from "../components/main/Maintable";
export default {
  name: "Mainyonghu",
  components: {
    Maintable,
  },
  computed: {},
  data() {
    return {
      text: "",
      size: 6,
      page: 1,
      total: 0,
      currentPage: 1,
      yonghuArr: [],
      yongHuZhuangTai: "",
      yongHuZhanDian: "",
      yongHuZhuangTaiArr: [
        {
          YHvalue: 0,
          YHlabel: "正常",
        },
        {
          YHvalue: 1,
          YHlabel: "冻结中",
        },
      ],
      yongHuZhanDianArr: JSON.parse(window.localStorage.getItem("allzhandianArr")),
      valuetype: "ZDlabel",
    };
  },
  methods: {
    //删除弹出提示框
    psyDelBut(id) {
      this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "删除成功!",
          });
          // console.log(id);
          this.deletes(id);
          this.selects();
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    //单个删除
    deletes(id) {
      // console.log(id);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/siteDeleteById",
        params: { id },
      })
        .then((res) => {
          // console.log(res);
          // this.tableData = res.data.data;
        })
        .catch((err) => {
          console.log(err);
        });
    },
    handleSizeChange(val) {
      this.size = val;
      console.log(`每页 ${val} 条`);
      this.selects();
    },
    handleCurrentChange(val) {
      this.page = val;
      console.log(`当前页: ${val}`);
      this.selects();
    },
    //批量冻结/解冻
    batchisfrez() {
      var Arr = JSON.parse(window.localStorage.getItem("val"));
      // console.log(Arr);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/usermanager/updateOutAllState",
        data: Arr,
      })
        .then((res) => {
          // console.log(res);
          // this.tableData = res.data.data;
        })
        .catch((err) => {
          console.log(err);
        });
      // this.selects();
    },
    //批量解冻
    batchthrfrez() {
      var Arr = JSON.parse(window.localStorage.getItem("val"));
      // console.log(Arr);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/usermanager/updateAllState",
        data: Arr,
      })
        .then((res) => {
          // console.log(res);
          // this.tableData = res.data.data;
        })
        .catch((err) => {
          console.log(err);
        });
      // this.selects();
    },
    //查看
    yhChaKan() {
      this.$router.push({ path: "/yonghuxiangqin" });
    },
    //获取页面数据
    selects() {
      // console.log(this.text);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/usermanager/selectUserManagerByName",
        data: {
          site_id: this.yongHuZhanDian,
          state: this.yongHuZhuangTai,
          name: this.text,
          page: this.page,
          size: this.size,
        },
      })
        .then((response) => {
          this.total = response.data.total;
          this.yonghuArr = response.data.data;
          console.log(response.data);
        })
        .catch((error) => {
          console.log(error);
        });
    },
  },
  mounted() {
    this.selects();
  },
};
</script>

<style lang="less" scoped>
.search {
  margin: 10px 40px 0 20px;
  width: 20%;
}
.block {
  margin: 0 130px;
  float: right;
}
</style>
=======
<!--
 * @Author: Xia_cc 978487464@qq.com
 * @Date: 2022-06-08 16:57:05
 * @LastEditors: Xia_cc 978487464@qq.com
 * @LastEditTime: 2022-06-10 18:40:12
 * @FilePath: \vue 小U到家\src\views\Mainyonghu.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!--  -->
<template>
  <el-container>
    <el-header>
      关键字:<el-input
        class="search"
        type="text"
        placeholder="请输入内容"
        v-model="text"
        @change="selects()"
        size="mini"
      ></el-input>
      状态:<el-select
        class="search"
        @input="selects()"
        v-model="yongHuZhuangTai"
        size="mini"
        placeholder="请选择"
      >
        <el-option
          v-for="item in yongHuZhuangTaiArr"
          :key="item.YHvalue"
          :label="item.YHlabel"
          :value="item.value"
          size="mini"
        >
        </el-option>
      </el-select>
      站点:<el-select
        class="search"
        @input="selects()"
        v-model="yongHuZhanDian"
        size="mini"
        placeholder="请选择"
      >
        <el-option
          v-for="item in yongHuZhanDianArr"
          :key="item.ZDvalue"
          :label="item.ZDlabel"
          :value="item.ZDvalue"
        >
        </el-option>
      </el-select>
    </el-header>

    <el-main>
      <el-row>
        <el-button type="info" plain>导出</el-button>
        <el-button type="info" plain>冻结/解冻</el-button>
      </el-row>
      <Maintable :tableData="yonghuArr">
        <template v-slot:tableline>
          <el-table-column prop="date" label="姓名" width="120"> </el-table-column>
          <el-table-column prop="name" label="电话" width="160"> </el-table-column>
          <el-table-column prop="date" label="最后活跃时间" width="180"> </el-table-column>
          <el-table-column prop="name" label="配送订单数" width="120"> </el-table-column>
          <el-table-column prop="date" label="所属站点" width="160"> </el-table-column>
          <el-table-column prop="name" label="状态" width="120"> </el-table-column>
        </template>
        <template v-slot:chaozuo>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button
                type="success"
                slot="reference"
                plain
                title="查看"
                icon="el-icon-view"
                @click="yhChaKan"
              >
                <!-- <router-link to="/yonghuxiangqin"></router-link> -->
              </el-button>
              <el-button
                type="primary"
                plain
                icon="el-icon-edit"
                title="编辑"
                @click="updates(scope.row.id)"
              ></el-button>
              <el-button
                type="danger"
                plain
                icon="el-icon-delete"
                title="删除"
                @click="
                  deletes(scope.row.id);
                  psyDelBut();
                "
              ></el-button>
            </template>
          </el-table-column>
        </template>
      </Maintable>
    </el-main>
    <router-view></router-view>
  </el-container>
</template>

<script>
import Maintable from "../components/main/Maintable";
export default {
  name: "Mainyonghu",
  components: {
    Maintable,
  },
  computed: {},
  data() {
    return {
      text: "",
      yonghuArr: [],
      yongHuZhuangTai: "",
      yongHuZhanDian: "",
      yongHuZhuangTaiArr: [
        {
          YHvalue: "yh选项1",
          YHlabel: "正常",
        },
        {
          YHvalue: "yh选项2",
          YHlabel: "冻结中",
        },
      ],
      yongHuZhanDianArr: [
        {
          ZDvalue: "选项1",
          ZDlabel: "青羊区",
        },
        {
          ZDvalue: "选项2",
          ZDlabel: "武侯区",
        },
        {
          ZDvalue: "选项3",
          ZDlabel: "温江区",
        },
        {
          ZDvalue: "选项4",
          ZDlabel: "金牛区",
        },
      ],
      valuetype: "ZDlabel",
    };
  },
  methods: {
    //批量冻结/解冻
    batchisfrez() {
      var Arr = JSON.parse(window.localStorage.getItem("val"));
      // console.log(Arr);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/usermanager/updateOutAllState",
        data: Arr,
      })
        .then((res) => {
          // console.log(res);
          // this.tableData = res.data.data;
        })
        .catch((err) => {
          console.log(err);
        });
      // this.selects();
    },
    //批量解冻
    batchthrfrez() {
      var Arr = JSON.parse(window.localStorage.getItem("val"));
      // console.log(Arr);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/usermanager/updateAllState",
        data: Arr,
      })
        .then((res) => {
          // console.log(res);
          // this.tableData = res.data.data;
        })
        .catch((err) => {
          console.log(err);
        });
      // this.selects();
    },
    //查看
    yhChaKan() {
      this.$router.push({ path: "/yonghuxiangqin" });
    },
    //获取页面数据
    selects() {
      // console.log(this.text);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/usermanager/selectUserManagerByName",
        data: {
          site_id: this.yongHuZhanDian,
          state: this.yongHuZhuangTai,
          name: this.text,
          page: 1,
          size: 8,
        },
      })
        .then((response) => {
          this.yonghuArr = response.data.data;
          console.log(response.data);
        })
        .catch((error) => {
          console.log(error);
        });
    },
  },
  mounted() {
    this.selects();
  },
};
</script>

<style lang="less" scoped>
.search {
  margin: 10px 40px 0 20px;
  width: 20%;
}
</style>
>>>>>>> ae27e4fe2d4f939d0b0ee2bfa506b9e3269c53cb
